<template>
  <span class="title">巡更报告</span>
  <div class="condition">
    <el-form :inline="true" :model="tableFrom">
      <el-row :gutter="20">
        <el-col :span="12">
          <el-form-item label="时间范围">
            <el-date-picker
              v-model="tableFrom.timer"
              type="daterange"
              range-separator="To"
              start-placeholder="Start date"
              end-placeholder="End date"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="10">
          <el-input
            v-model="tableFrom.name"
            placeholder="巡更人"
            class="input-with-select"
          >
            <template #append>
              <el-button :icon="Search"></el-button>
            </template>
          </el-input>
        </el-col>
      </el-row>
    </el-form>
  </div>
  <div class="datatable">
    <el-table
      :data="tableData"
      border
      style="width: 100%; box-sizing: border-box"
      max-height="550"
    >
      <el-table-column type="index" :align="'center'" />
      <el-table-column
        prop="name"
        :label="t(`module.table.PatrolOfficer`)"
        :align="'center'"
        width="120"
      />
      <el-table-column
        prop="number"
        :label="t(`module.table.HandleTime`)"
        :align="'center'"
        width="120"
      />
      <el-table-column
        prop="belongto"
        :label="t(`module.table.Garden`)"
        :align="'center'"
        width="220"
      />
      <el-table-column
        prop="tel"
        :label="t(`module.table.Parent`)"
        :align="'center'"
        width="180"
      />
      <el-table-column
        prop="belongto"
        :label="t(`module.table.RoomNo`)"
        :align="'center'"
        width="220"
      />
      <el-table-column
        prop="parent"
        :label="t(`module.table.Parent`)"
        :align="'center'"
        width="220"
      />
      <el-table-column
        prop="parent"
        :label="t(`module.table.CreateTime`)"
        :align="'center'"
        width="220"
      />
      <el-table-column
        prop="date"
        :label="t(`module.table.Remark`)"
        :align="'center'"
        width="160"
      />
    </el-table>
    <el-row :gutter="20">
      <el-col :span="10" :offset="10">
        <el-pagination
          small
          background
          layout="prev, pager, next"
          :total="tableData.length"
          class="mt-4"
        >
        </el-pagination>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { reactive, toRefs } from "vue";
import { useI18n } from "vue-i18n";
import { Search } from "@element-plus/icons-vue";

export default {
  name: "Customer-List",

  setup() {
    const { t } = useI18n();

    let state = reactive({
      tableData: [
        {
          date: "2016-05-03",
          name: "Tom",
          sex: 0,
          tel: "17811113333",
          number: "44564564865325",
          belongto: "进城市陶大区",
          status: true,
          remarks: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-01-02",
          name: "Cici",
          sex: 0,
          tel: "17811113333",
          number: "11f56a156fa48",
          belongto: "进城市陶大区",
          status: true,
          remarks: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-02-12",
          name: "TITI",
          sex: 1,
          tel: "11f56a156fa48",
          number: "11f56a156fa48",
          belongto: "进城市陶大区",
          status: true,
          remarks: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-05-03",
          name: "TT",
          sex: 1,
          tel: "11f56a156fa48",
          number: "44564564865325",
          belongto: "进城市陶大区",
          status: false,
          remarks: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-05-03",
          name: "Tom",
          sex: 0,
          tel: "17811113333",
          number: "44564564865325",
          belongto: "进城市陶大区",
          status: true,
          remarks: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-05-03",
          name: "Tom",
          sex: 0,
          tel: "17811113333",
          number: "44564564865325",
          belongto: "进城市陶大区",
          status: true,
          remarks: "No. 189, Grove St, Los Angeles",
        },
        {
          date: "2016-05-03",
          name: "Tom",
          sex: 0,
          tel: "17811113333",
          number: "44564564865325",
          belongto: "进城市陶大区",
          status: false,
          remarks: "No. 189, Grove St, Los Angeles",
        },
      ],
      tableFrom: {
        status: "",
        timer: "",
        expire: "",
        name: "",
        sex: null,
        tel: "",
      },
    });

    return {
      t,
      ...toRefs(state),
      Search,
    };
  },
};
</script>

<style lang="scss" scoped>
.title {
  display: block;
  padding: 2rem 1rem;
  font-size: 2rem;
  font-weight: bolder;
  text-align: left;
}
.search {
  display: flex;
  width: 30rem;
  padding: 1rem;
}
.datatable {
  box-sizing: border-box;
  padding: 0.625rem;
}
.ml-1 {
  margin-left: 1rem;
}
</style>
